﻿//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Drawing;
//using OpenTK;
//using OpenTK.Graphics.OpenGL;

//namespace ModelNamer
//{
//    /// <summary>
//    /// Demonstrates immediate mode rendering.
//    /// </summary>
//    //[Example("Immediate mode", ExampleCategory.OpenGL, "1.x", 1, Documentation = "ImmediateMode")]
//    public class ImmediateCube : GameWindow
//    {
//        #region --- Fields ---

//        const float rotation_speed = 180.0f;
//        float angle;

//        #endregion

//        #region --- Constructor ---

//        public ImmediateCube()
//            : base(800, 600)
//        { }

//        #endregion

//        #region OnLoad

//        protected override void OnLoad(EventArgs e)
//        {
//            base.OnLoad(e);

//            GL.ClearColor(System.Drawing.Color.MidnightBlue);
//            GL.Enable(EnableCap.DepthTest);
//        }

//        #endregion

//        #region OnResize

//        /// <summary>
//        /// Called when the user resizes the window.
//        /// </summary>
//        /// <param name="e">Contains the new width/height of the window.</param>
//        /// <remarks>
//        /// You want the OpenGL viewport to match the window. This is the place to do it!
//        /// </remarks>
//        protected override void OnResize(EventArgs e)
//        {
//            base.OnResize(e);

//            GL.Viewport(0, 0, Width, Height);

//            double aspect_ratio = Width / (double)Height;

//            OpenTK.Matrix4 perspective = OpenTK.Matrix4.CreatePerspectiveFieldOfView(MathHelper.PiOver4, (float)aspect_ratio, 1, 64);
//            GL.MatrixMode(MatrixMode.Projection);
//            GL.LoadMatrix(ref perspective);
//        }

//        #endregion

//        #region OnUpdateFrame

//        /// <summary>
//        /// Prepares the next frame for rendering.
//        /// </summary>
//        /// <remarks>
//        /// Place your control logic here. This is the place to respond to user input,
//        /// update object positions etc.
//        /// </remarks>
//        protected override void OnUpdateFrame(FrameEventArgs e)
//        {
//            base.OnUpdateFrame(e);

//            if (Keyboard[OpenTK.Input.Key.Escape])
//            {
//                this.Exit();
//                return;
//            }
//        }

//        #endregion

//        #region OnRenderFrame

//        /// <summary>
//        /// Place your rendering code here.
//        /// </summary>
//        protected override void OnRenderFrame(FrameEventArgs e)
//        {
//            base.OnRenderFrame(e);

//            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

//            Matrix4 lookat = Matrix4.LookAt(0, 5, 5, 0, 0, 0, 0, 1, 0);
//            GL.MatrixMode(MatrixMode.Modelview);
//            GL.LoadMatrix(ref lookat);

//            angle += rotation_speed * (float)e.Time;
//            GL.Rotate(angle, 0.0f, 1.0f, 0.0f);

//            DrawCube();

//            this.SwapBuffers();
//            //Thread.Sleep(1);
//        }

//        #endregion

//        #region private void DrawCube()

//        private void DrawCube()
//        {
//            GL.Begin(PrimitiveType.Quads);

//            GL.Color3(Color.Silver);
//            GL.Vertex3(-1.0f, -1.0f, -1.0f);
//            GL.Vertex3(-1.0f, 1.0f, -1.0f);
//            GL.Vertex3(1.0f, 1.0f, -1.0f);
//            GL.Vertex3(1.0f, -1.0f, -1.0f);

//            GL.Color3(Color.Honeydew);
//            GL.Vertex3(-1.0f, -1.0f, -1.0f);
//            GL.Vertex3(1.0f, -1.0f, -1.0f);
//            GL.Vertex3(1.0f, -1.0f, 1.0f);
//            GL.Vertex3(-1.0f, -1.0f, 1.0f);

//            GL.Color3(Color.Moccasin);

//            GL.Vertex3(-1.0f, -1.0f, -1.0f);
//            GL.Vertex3(-1.0f, -1.0f, 1.0f);
//            GL.Vertex3(-1.0f, 1.0f, 1.0f);
//            GL.Vertex3(-1.0f, 1.0f, -1.0f);

//            GL.Color3(Color.IndianRed);
//            GL.Vertex3(-1.0f, -1.0f, 1.0f);
//            GL.Vertex3(1.0f, -1.0f, 1.0f);
//            GL.Vertex3(1.0f, 1.0f, 1.0f);
//            GL.Vertex3(-1.0f, 1.0f, 1.0f);

//            GL.Color3(Color.PaleVioletRed);
//            GL.Vertex3(-1.0f, 1.0f, -1.0f);
//            GL.Vertex3(-1.0f, 1.0f, 1.0f);
//            GL.Vertex3(1.0f, 1.0f, 1.0f);
//            GL.Vertex3(1.0f, 1.0f, -1.0f);

//            GL.Color3(Color.ForestGreen);
//            GL.Vertex3(1.0f, -1.0f, -1.0f);
//            GL.Vertex3(1.0f, 1.0f, -1.0f);
//            GL.Vertex3(1.0f, 1.0f, 1.0f);
//            GL.Vertex3(1.0f, -1.0f, 1.0f);

//            GL.End();
//        }

//        #endregion

//        #region public static void Main()

//        /// <summary>
//        /// Entry point of this example.
//        /// </summary>
//        [STAThread]
//        public static void Main()
//        {
//            using (ImmediateCube example = new ImmediateCube())
//            {
//                //Utilities.SetWindowTitle(example);
//                example.Run(30.0, 30.0);
//            }
//        }

//        #endregion
//    }
//}
